package com.dg.gaming.api.common.msg;

import nanoxml.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class MsgConnectTable extends MsgTableMessage {
    private long gameID = -1;

    protected static final String XML_ATT_GAME_ID = "gameID";

    public MsgConnectTable(long tableNum, long userid, long gameID) {
        super(userid);
        setTableNum("" + tableNum);
        this.gameID = gameID;
    }

    public MsgConnectTable(XMLElement message) {
        super(message);
        this.gameID = message.getLongAttribute(XML_ATT_GAME_ID, -1);
    }

    public XMLElement flatten() {
        XMLElement message = super.flatten(Msg.CONNECT_TABLE);
        if (gameID != -1) {
            message.setLongAttribute(XML_ATT_GAME_ID, gameID);
        }
        return message;
    }

    public long getGameID() {
        return gameID;
    }
}
